<?php

use backend\assets\AgentAsset;
use yii\helpers\Html;
use yii\helpers\Url;

$menuList = isset($this->params['menuList']) ? $this->params['menuList'] : [];

AgentAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate" />
    <?= Html::csrfMetaTags() ?>
    <title>美粒儿店务管理系统</title>
    <?php $this->head() ?>
	<style>
		.shade{
			position: fixed;
			top: 0;
			left: 0;
			z-index: 99998;
			width: 100%;
			height: 100%;
			background-color: #000;
			opacity: 0.7;
			filter: alpha(opacity=70);
		}
		.aniPic {
			position: absolute;
			right: 186px;
			z-index: 99999;
		}


		/* .slideThree */
		.slideThree {
			width: 65px;
			height: 26px;
			background: #333;

			position: relative;
			-moz-border-radius: 50px;
			-webkit-border-radius: 50px;
			border-radius: 50px;
			-moz-box-shadow: inset 0px 1px 1px rgba(255, 255, 255, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2);
			-webkit-box-shadow: inset 0px 1px 1px rgba(255, 255, 255, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2);
			box-shadow: inset 0px 1px 1px rgba(255, 255, 255, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2);
		}
		.slideThree:after {
			content: 'off';
			color: #fff;
			position: absolute;
			right: 4px;
			z-index: 0;
			font: 12px/26px Arial, sans-serif;
			font-weight: bold;
			text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.15);
		}
		.slideThree:before {
			content: 'on';
			color: #fff;
			position: absolute;
			left: 4px;
			z-index: 0;
			font: 12px/26px Arial, sans-serif;
			font-weight: bold;
		}
		.slideThree label {
			display: block;
			width: 20px;
			height: 20px;
			cursor: pointer;
			position: absolute;
			top: 3px;
			left: 3px;
			z-index: 1;
			background: #ec6333;
			-moz-border-radius: 50px;
			-webkit-border-radius: 50px;
			border-radius: 50px;
			-moz-transition: all 0.4s ease;
			-o-transition: all 0.4s ease;
			-webkit-transition: all 0.4s ease;
			transition: all 0.4s ease;
			-moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
			-webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
			box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
		}
		.slideThree input[type=checkbox] {
			visibility: hidden;
		}
		.slideThree input[type=checkbox]:checked + label {
			background: #fe84a4;
			left: 43px;
		}
		/* end .slideThree */

		@media (max-width: 1279px){
			.top-bar #navbar-collapse .top-bar-right .imgBg{display: none;}
			.top-bar .user-menu .user-menu-title{width: auto;}
		}
	</style>
</head>
<body>
<?php $this->beginBody() ?>
		<div class="navbar navbar-inverse navbar-static-top top-bar">
			<div class="container-fluid" style="padding-left: 30px">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
						<span class="sr-only" translate="">Toggle navigation</span>
						<span class="icon-bar icon-bar-1"></span>
						<span class="icon-bar icon-bar-2"></span>
						<span class="icon-bar icon-bar-3"></span>
					</button>
					<div class="user-menu clearfix">
						<img class="pull-left mr20" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/touxiang.png') ?>" alt="meelier">
						<div class="user-menu-title pull-left">
							欢迎<br>
							<div class="name"><?=$this->userinfo->user_name?></div>
						</div>
					</div>
				</div>

				<div class="collapse navbar-collapse" id="navbar-collapse">
					<ul class="top-bar-left nav navbar-nav">

						<?php foreach($menuList as $menu): ?>
							<?php if ($menu['_child']) { ?>

								<li class="dropdown <?php if($this->params['controller_name'] == $menu['controller_name']): ?>active <?php endif;?> " style="position: relative;">
									<a href="<?= $menu['menu_url'] ? Url::to([$menu['menu_url']]) : 'javascript:;' ?>" class="dropdown-toggle" data-toggle="dropdown" data-delay="" data-hover="dropdown" data-close-others="false"><em><i><?= $menu['titile'] ?></i></em></a>
									<ul class="dropdown-menu">
										<?php foreach($menu['_child'] as $val): ?>
											<li><a tabindex="-1" href="<?= $val['menu_url'] ? Url::to([$val['menu_url']]) : 'javascript:;' ?>"><?= $val['titile'] ?></a></li>
										<?php endforeach; ?>
									</ul>
								</li>

							<?php } else { ?>

								<li><a href="<?= Url::to([$menu['menu_url']]) ?>"><?= $menu['titile'] ?></a></li>

							<?php } ?>
						<?php endforeach; ?>

					</ul>
					<ul class="top-bar-right nav navbar-nav navbar-right">
						<?php if(isset($this->params['shoplist'])):?>
						<li class="dropdown shops">
							<a class="dropdown-toggle" data-toggle="dropdown" href="">
								<?php foreach($this->params['shoplist'] as $r):?>
								<?php if($r['shop_id'] == $this->userinfo->shop_id):?><sapn class="shop-name"><?=$r['shop_name']?> </sapn><?php endif;?>
								<?php endforeach;?>
								<i>&gt;</i></a>
							<ul class="dropdown-menu">
								<?php foreach($this->params['shoplist'] as $r):?>
								<li><a href="<?=Url::toRoute(['/system/site/changeshop','shop_id'=>$r['shop_id']])?>"><?=$r['shop_name']?></a></li>
								<?php endforeach;?>
							</ul>
						</li>

						<?php endif;?>
						<li class="imgBg"><img src="<?= Yii::getAlias('@web/backend/img/home/top-bar/logo.png') ?>" alt="meelier"></li>
						<li class="rightBtn dropdown subNav">
							<a class="dropdown-toggle moreIcon" data-toggle="dropdown" href=""><img src="" alt=""/><img src="<?= Yii::getAlias('@web/backend/img/home/top-bar/moreicon.png') ?>" alt=""/></a>
							<ul class="dropdown-menu">
								<li><a class="btnAdd" href="javascript:;" dhref="<?= Url::to(['/system/public/password', 'type' => 'boss']) ?>" dtitle="修改密码"><img class="imgIcon changePwd" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/key.png') ?>" alt=""/>修改密码</a></li>
								<?php if($this->userinfo->user_type == 3){?>
								<li><a href="<?=Url::toRoute(['/business/shopmanage/list'])?>"><img class="imgIcon list" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/profile1.png') ?>" alt=""/>分店列表</a></li>
								<?php }?>
								<li><a href="<?=Url::toRoute(['/business/config/list','type'=>1])?>"><img class="imgIcon fix" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/icon_settings.png') ?>" alt=""/>系统维护</a></li>
								<li class="dropMenu3">
									<div class="slideThree">
										<input type="checkbox" value="None" id="slideThree" name="check" checked/>
										<label class="switchBtn" for="slideThree"></label>
									</div>
									<a class="a_slideThree" href="javascript:;" style="padding-left: 103px;"><em class="text w2">动效</em></a>
								</li>
								<li><a href="<?=Url::toRoute('/base/logout')?>"><img class="imgIcon logout" src="<?= Yii::getAlias('@web/backend/img/home/top-bar/closeexcit.png') ?>" alt=""/><em class="text w2">退出</em></a></li>

							</ul>
						</li>
					</ul>
				</div>

			</div>

		</div>

<div class="switchBox" style="display: none;">
	<div class="shade"></div>
	<div class="aniPic">
		<img class="" src="<?= Yii::getAlias('@web/backend/img/switch/animation.png') ?>" alt=""/>
	</div>
</div>

				<?=$content ?>

<?php $this->beginBlock('js_index_end') ?>
$('.top-bar-left>li').hover(function(){
$(this).find('i').addClass('animated flipInX');
},function(){
$(this).find('i').removeClass('animated flipInX');
});

		/*窗口放大放小*/
		function wrap_mid(){
			$('.mid').toggleClass('mids');
		}
		/*框架大小调整*/
		function body_height(){
			var bodyheight=document.body.clientHeight,
				height=bodyheight-80,
				bodywidth=document.body.clientWidth,
				right_width=bodywidth-201;
	
			$('.wrap_main').height(height);
<!--			$('.wrap_right').width(right_width);-->
		}
		
		$(window).resize(function(){
			body_height();
		});
		$(function(){
			body_height();
			//$("#myform").Validform();
		})
		
		/*left顶部增加菜单效果*/
		$('.left_top .m').hover(function(){
			$(this).toggleClass('m_on');
			$(this).find('ul').toggle();
		})
		/*修改分店*/
		$("#changeshop").change(function(){
			var url = $(this).val();
			location.href = url;
		})
		
		
		/*left导航背景伪类*/
		$('.left_nav li a').hover(function(){
			var bg_pic='i/'+$(this).attr('bg_pic')+'s.jpg';
			$(this).css('background-image','url('+bg_pic+')');
		},function(){
			if(!$(this).hasClass('on')){
				var bg_pic='i/'+$(this).attr('bg_pic')+'.jpg';
				$(this).css('background-image','url('+bg_pic+')');
			}
		})
		
		/*left导航整体效果*/
		var left_nav_a=$('.left_nav li a'),prev_a=0;
		left_nav_a.click(function(){
			
			var bg_pic='i/'+left_nav_a.eq(prev_a).attr('bg_pic')+'.jpg';
			left_nav_a.eq(prev_a).css('background-image','url('+bg_pic+')');
			
			prev_a=left_nav_a.index(this);
			left_nav_a.removeClass('on').filter($(this)).addClass('on');
			var bg_pic='i/'+$(this).attr('bg_pic')+'s.jpg';
			$(this).css('background-image','url('+bg_pic+')');
		
			$(this).next('ul').slideToggle(100);
			var _url=$(this).attr('href');
			
			$(this).parent().siblings().find('ul').slideUp(100);
			window.parent.main.location.href=_url;
			return false;
		})

<?php
$session = Yii::$app->session;
if ($session->hasFlash('tips_msg')) {
//	echo "layer.alert('{$session->getFlash('tips_msg')}', {icon:1})";
} ?>

<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['js_index_end'], $this::POS_END); ?>
<?php $this->registerJsFile("@web/system/layouts/agent.js",['position'=>$this::POS_END]);?>

<?php $this->endBody() ?>



</body>
</html>
<?php $this->endPage() ?>
